package com.yznote.cloudesk.file.server.impl;

import com.yznote.cloudesk.common.codeResult.YResult;
import com.yznote.cloudesk.common.pojo.File;
import com.yznote.cloudesk.common.pojo.Result;
import com.yznote.cloudesk.compileservice.CompileService;
import com.yznote.cloudesk.file.mapper.FileMapper;
import com.yznote.cloudesk.file.server.RunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RunServiceImpl implements RunService {
    @Autowired
    FileMapper fileMapper;
    @Autowired
    CompileService compileService;

    @Override
    public YResult runFile(Long fileId) {
        File filemsg = fileMapper.getFilemsg(fileId);
        String fileName = filemsg.getFileName();
        String filePath = filemsg.getFilePath();
        Result<YResult> run = compileService.run(fileName, filePath);
        return run.getData();
    }
}
